package test.tradeflow;

import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 *
 * @ project name : example
 * @ Author: XuLeHuang
 * @ Date: 2023/1/8 13:55
 * @ Description:
 */
public class EcnyTradeContext<T, R> extends TradeContext<T, R> {
    public static <T, R> EcnyTradeContext<T, R> getInstance(T reqMsg) {
        EcnyTradeContext<T, R> context = new EcnyTradeContext<>();
        context.setReqMsg(reqMsg);
        return context;
    }
    public static <T> T getReqMsg(TradeContext<?, ?> context) {
        return (T) context.getReqMsg();
    }

    public static <R> R getRspMsg(TradeContext<?, ?> context) {
        return (R) context.getRspMsg();
    }

    public static <T, R> void setRspMsg(TradeContext<?, ?> context, R rspMsg) {
        ((EcnyTradeContext<T, R>) context).setRspMsg(rspMsg);
    }

    public static Map<String, Object> getTempContext(TradeContext<?, ?> context) {
        return context.getTempCtx();
    }
}
